#include "zf_common_headfile.h"
#include "CUART.h"
#include "stdio.h"
#include "string.h"

char buff[30];
int rx_cnt = 0;
UART_S UART;

int uart_put_buf(uint8_t ch)
{
    UART.buf[UART.head++] = ch;
    if(UART.head == UART_RX_MAX)
    {
        UART.head = 0;
    }
    return 0; 
}

int uart_get(uint8_t *ch)
{
    if(UART.head != UART.tail)
    {
        *ch = UART.buf[UART.tail++];
        if(UART.tail == UART_RX_MAX)
        {
            UART.tail = 0;
        }
        return 1;
    }
    return 0;
}


void Rx_buff(void)
{
    uint8_t ch;
    if(uart_get(&ch) == 1)
    {
        buff[rx_cnt++] = ch;
        if(rx_cnt>=30)
        {
            rx_cnt=0;
            memset(buff,0,30);
        }
    }
}





